﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package Classes.util {
    import Engine.Classes.*;
    import Engine.Managers.*;
    import Display.*;
    import Engine.*;

    public class GameFacebookUtil extends FacebookUtil {

        private static const NUM_QUEUED_ACTIONS_REDIRET:int = 5;

        public function GameFacebookUtil(_arg1:String, _arg2:String){
            super(_arg1, _arg2);
        }
        override public function redirect(_arg1:String, _arg2:Object=null, _arg3:String="_parent", _arg4:Boolean=true):void{
            if (_arg4){
                _arg1 = (Config.SN_APP_URL + _arg1);
            };
            Utilities.launchURL(_arg1, _arg3, _arg2);
        }
        override public function getDefaultFeedImages():Array{
            var _local2:int;
            var _local3:int;
            var _local4:int;
            var _local1:Array = [];
            if (((!((GlobalEngine.getFlashVar("levelUpFeed1") == null))) || (!((GlobalEngine.getFlashVar("levelUpFeed2") == null))))){
                _local2 = Math.round(Utilities.randBetween(1, 8));
                switch (_local2){
                    case 1:
                    case 8:
                        _local1.push({
                            src:(Config.ASSET_BASE_PATH + "assets/newsfeed/levelup_singleframe_01.png"),
                            href:"{SN_APP_URL}{creative:1}index.php"
                        });
                        break;
                    case 2:
                        _local1.push({
                            src:(Config.ASSET_BASE_PATH + "assets/newsfeed/levelup_singleframe_02.png"),
                            href:"{SN_APP_URL}{creative:2}index.php"
                        });
                        break;
                    case 3:
                        _local1.push({
                            src:(Config.ASSET_BASE_PATH + "assets/newsfeed/levelup_singleframe_03.png"),
                            href:"{SN_APP_URL}{creative:3}index.php"
                        });
                        break;
                    case 4:
                        _local1.push({
                            src:(Config.ASSET_BASE_PATH + "assets/newsfeed/levelup_singleframe_04.png"),
                            href:"{SN_APP_URL}{creative:4}index.php"
                        });
                        break;
                    case 5:
                        _local1.push({
                            src:(Config.ASSET_BASE_PATH + "assets/newsfeed/levelup_singleframe_05.png"),
                            href:"{SN_APP_URL}{creative:5}index.php"
                        });
                        break;
                    case 6:
                        _local1.push({
                            src:(Config.ASSET_BASE_PATH + "assets/newsfeed/levelup_singleframe_06.png"),
                            href:"{SN_APP_URL}{creative:6}index.php"
                        });
                        break;
                    case 7:
                        _local1.push({
                            src:(Config.ASSET_BASE_PATH + "assets/newsfeed/levelup_singleframe_07.png"),
                            href:"{SN_APP_URL}{creative:7}index.php"
                        });
                        break;
                };
            } else {
                _local3 = Math.round(Utilities.randBetween(0, 2));
                if (_local3 <= 1){
                    _local1.push({
                        src:(Config.ASSET_BASE_PATH + "assets/newsfeed/levelup_singleframe_01.png"),
                        href:"{SN_APP_URL}{creative:1}index.php"
                    });
                } else {
                    _local4 = Math.round(Utilities.randBetween(0, 1));
                    switch (_local4){
                        case 0:
                            _local1.push({
                                src:(Config.ASSET_BASE_PATH + "assets/newsfeed/levelup_singleframe_02.png"),
                                href:"{SN_APP_URL}{creative:0}index.php"
                            });
                            break;
                        case 1:
                            _local1.push({
                                src:(Config.ASSET_BASE_PATH + "assets/newsfeed/levelup_singleframe_03.png"),
                                href:"{SN_APP_URL}{creative:2}index.php"
                            });
                            break;
                    };
                };
            };
            return (_local1);
        }
        override public function onFeedClosed():void{
            super.onFeedClosed();
            UI.thawScreen();
        }
        override public function onPermissionDialogClosed(_arg1:Boolean):void{
            super.onPermissionDialogClosed(_arg1);
            if (_arg1){
                UI.displayMessage(ZLoc.t("Dialogs", "Permissions_stream_accept"));
                StatsManager.count("streamPermissions", "accept");
            } else {
                StatsManager.count("streamPermissions", "cancel");
            };
            Global.player.checkSeenExtendedPermissions(Global.player.SEEN_EXTENDED_PERMISSIONS_ANY);
        }
        override public function streamPublish(_arg1:Object, _arg2:Object, _arg3:String, _arg4:String=null, _arg5:Function=null, _arg6:Boolean=false, _arg7:String=""):void{
            var _local8:Boolean;
            super.streamPublish(_arg1, _arg2, _arg3, _arg4, _arg5);
            if (this.userHasStreamPermissions()){
                _local8 = Global.player.checkSeenExtendedPermissions(Global.player.SEEN_EXTENDED_PERMISSIONS_ANY, false);
                if (((!(_local8)) && (!(Global.player.getSeenFlag("autoPubDlg"))))){
                    UI.displayMessage(ZLoc.t("Dialogs", "Permissions_stream_accept_no_prompt"));
                    Global.player.setSeenFlag("autoPubDlg");
                };
            };
        }
        override public function publishFeedStory(_arg1:String, _arg2:Object, _arg3:Array, _arg4:Boolean, _arg5:Function=null, _arg6:int=0, _arg7:Boolean=false, _arg8:Boolean=false, _arg9:String=""):void{
            if (!Global.autoPublishEnabled){
                _arg7 = false;
            };
            super.publishFeedStory(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7);
        }
        override public function userHasStreamPermissions():Boolean{
            var _local1:Boolean = m_hasPublishPermissions;
            if (!Global.autoPublishEnabled){
                _local1 = false;
            };
            return (_local1);
        }

    }
}//package Classes.util 
